home *** CD-ROM | disk | FTP | other *** search
- /* Angle Correction */
-
- call addlib("rexxmathlib.library", 5, -30, 0)
-
- options results
- parse ARG Port x y x2 y2 b
- ADDRESS value Port
-
-
- Pi=3.1415926
- If x>x2 then DO;tx=x;x=x2;x2=tx;ty=y;y=y2;y2=ty;END
-
- Dx=abs(x2-x)+1;Dy=abs(y2-y)+1
-
- If y>y2 then DO
- Prot=0.5*Pi+ATan(Dx/Dy)
- END
- ELSE
- DO
- Prot=0.5*Pi-ATan(Dx/Dy)
- END
-
- if x=x2 then DO;Prot=90*Pi/180;END
- if y=y2 then DO;Prot=0;END
-
- Prot=Prot*180/Pi
-
- Angle=Prot
-
- if Dy>Dx then
- DO
- if x2>x then
- DO
- Angle=90-Prot
- END
- ELSE
- DO
- Angle=Prot-90
- END
- END
- ELSE
- DO
- if y2>y then
- DO
- Angle=Prot*-1
- END
- ELSE
- DO
- Angle=180-Prot
- END
- END
- pp_Rotate trunc(Angle+0.5,3)
- pp_warn 'Angle*Correction*=*'||trunc(Angle+0.5,3)||'*°'
-
-
-
-
-
-
-
-
-